class AIPersonality {
  final String name;
  final String description;
  final Map<String, dynamic> traits;
  final List<String> conversationStyle;
  final String avatarPath;

  AIPersonality({
    required this.name,
    required this.description,
    required this.traits,
    required this.conversationStyle,
    this.avatarPath = 'assets/images/default_avatar.png',
  });

  Map<String, dynamic> toJson() => {
    'name': name,
    'description': description,
    'traits': traits,
    'conversationStyle': conversationStyle,
    'avatarPath': avatarPath,
  };

  factory AIPersonality.fromJson(Map<String, dynamic> json) => AIPersonality(
    name: json['name'],
    description: json['description'],
    traits: Map<String, dynamic>.from(json['traits']),
    conversationStyle: List<String>.from(json['conversationStyle']),
    avatarPath: json['avatarPath'],
  );

  // 预设人格
  static AIPersonality get defaultPersonality => AIPersonality(
    name: '默认AI助手',
    description: '一个友好、专业的AI助手',
    traits: {
      '友好度': 0.8,
      '专业度': 0.7,
      '幽默感': 0.5,
    },
    conversationStyle: [
      '使用礼貌用语',
      '保持专业态度',
      '适当使用表情符号',
    ],
  );

  // 创建自定义人格
  static AIPersonality createCustom({
    required String name,
    required String description,
    Map<String, dynamic>? traits,
    List<String>? conversationStyle,
    String? avatarPath,
  }) {
    return AIPersonality(
      name: name,
      description: description,
      traits: traits ?? defaultPersonality.traits,
      conversationStyle: conversationStyle ?? defaultPersonality.conversationStyle,
      avatarPath: avatarPath ?? defaultPersonality.avatarPath,
    );
  }
} 